home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Programmation / Gooey1.3.1 / C++ Templates / mmModalDialog.c < prev    next >
Text File  |  1994-04-16  |  19KB  |  572 lines

  1. $$Loop ModalDialogs
  2. $$Message MM Modal Dialog, mm:mmD_$Worksheet.name$.cp
  3.  
  4. $$File mm:mmD_$Worksheet.name$.cp
  5. /*  mmD_$Worksheet.name$                                 Handle this dialog */
  6. /*  $CopyRight$ */
  7.  
  8. /*    File name:  mmD_$Worksheet.name$.c
  9.     Function:  Handle this modal dialog.
  10.  
  11.     This dialog is called when:
  12.  
  13.     History: $Date$ Original by $Author$
  14.  
  15. */
  16.  
  17. #include "mmCommon$Prototype.name$.h"    /* Common */
  18. #include "Common$Prototype.name$.h"        /* Common */
  19.  
  20. /* ======================================================= */
  21. /* ======================================================= */
  22.  
  23. /* Routine: Init */
  24. /* Purpose: Initialize the modal dialog, globals and call users routine */
  25.  
  26. void CmmD$Worksheet.name$::Init()
  27. {
  28.  
  29.  
  30. inherited::Init();
  31.  
  32. $$Loop Control.type = Button
  33. this->Enable_$Control.name$ = $Control.Active$;        /* Button */
  34. $$EndLoop
  35. $$Loop Control.type = HotRect
  36. $$if Control.HotSpot
  37. this->Enable_$Control.name$ = $Control.Active$;        /* HotSpot  */
  38. $$endif
  39. $$EndLoop
  40. $$Loop Control.type = Checkbox
  41. this->Enable_$Control.name$ = $Control.Active$;        /* Checkbox  */
  42. $$if Control.Selected
  43. this->Value_$Control.name$ = 1;
  44. $$endif
  45. $$if Control.Unselected
  46. this->Value_$Control.name$ = 0;
  47. $$endif
  48. $$EndLoop
  49. $$Loop Control.type = Radio
  50. this->Enable_$Control.name$ = $Control.Active$;        /* Radio */
  51. $$if Control.Selected
  52. this->Value_$Control.name$ = 1;
  53. $$endif
  54. $$if Control.Unselected
  55. this->Value_$Control.name$ = 0;
  56. $$endif
  57. $$EndLoop
  58. $$Loop Control.type = ScrollBar
  59. this->Enable_$Control.name$ = $Control.Active$;        /* ScrollBar */
  60. this->Value_$Control.name$ = $Control.ValueScroll$;
  61. $$EndLoop
  62. $$Loop Control.type = Icon
  63. this->Enable_$Control.name$ = $Control.Active$;        /* Icon button  */
  64. $$EndLoop
  65. $$Loop Control.type = Sicn
  66. this->Enable_$Control.name$ = $Control.Active$;        /* Sicn button  */
  67. $$EndLoop
  68. $$Loop Control.type = Picture
  69. $$if Control.NonGraphic
  70. this->Enable_$Control.name$ = $Control.Active$;        /* Picture button  */
  71. $$endif
  72. $$EndLoop
  73. $$Loop Control.type = UButton
  74. this->Enable_$Control.name$ = $Control.Active$;        /* Plugin button */
  75. $$EndLoop
  76. $$Loop Control.type = UToggle
  77. this->Enable_$Control.name$ = $Control.Active$;        /* Plugin toggle */
  78. $$if Control.Selected
  79. this->Value_$Control.name$ = 1;
  80. $$endif
  81. $$if Control.Unselected
  82. this->Value_$Control.name$ = 0;
  83. $$endif
  84. $$EndLoop
  85. $$Loop Control.type = UGauge
  86. this->Enable_$Control.name$ = $Control.Active$;        /* Plugin gauge */
  87. this->Value_$Control.name$ = $Control.ValueScroll$;
  88. $$EndLoop
  89. $$Loop Control.type = Popup
  90. this->Enable_$Control.name$ = $Control.Active$;        /* Popup menu */
  91. this->Value_$Control.name$ = $Control.SelectedID$;
  92. $$EndLoop
  93. $$Loop Control.type = Palette
  94. this->Enable_$Control.name$ = $Control.Active$;        /* Palette */
  95. this->Value_$Control.name$ = $Control.ValueScroll$;
  96. $$EndLoop
  97. $$Loop Control.type = List
  98. this->List_$Control.name$ = nil;                        /* List */
  99. SetRect(&this->ListRect_$Control.name$,$Control.LeftPosition$,$Control.TopPosition$,$Control.RightPosition$,$Control.BottomPosition$);                /* left,top,right,bottom */
  100. $$EndLoop
  101. $$Loop Control.type = EditText
  102. this->TE_$Control.name$ = nil;                        /* Edit Text */
  103. SetRect(&this->TERect_$Control.name$,$Control.LeftPosition$,$Control.TopPosition$,$Control.RightPosition$,$Control.BottomPosition$);                /* left,top,right,bottom */
  104. GetIndString(this->TEStr_$Control.name$,sResD_$Control.name$,1);/*  ...Edit text, default value  */
  105. $$EndLoop
  106.  
  107. }
  108.  
  109. /* ======================================================= */
  110.  
  111. void CmmD$Worksheet.name$::FilterMouseDown(DialogPtr theDialog,EventRecord *theEvent,
  112.     short *itemHit,Point MyPt)
  113. {
  114. Rect            tempRect;                        /* Temporary rectangle */
  115. short            DType;                            /* Type of dialog item */
  116. short            code;
  117. Handle            DItem;                            /* Handle to the dialog item */
  118. ControlHandle    CItem;                            /* Control handle */
  119.  
  120.  
  121. inherited::FilterMouseDown(theDialog,theEvent,itemHit,MyPt);
  122.  
  123. $$Loop Control.type = List
  124. if (PtInRect(MyPt,&this->ListRect_$Control.name$))
  125.     ClickInTheList(MyPt,theEvent->modifiers,this->List_$Control.name$,
  126.         $Control.TextSize$,$Control.TextFont$,$Control.TextStyle$,true);
  127.  
  128. $$EndLoop
  129. $$Loop Control.type = ScrollBar
  130. GetDItem (theDialog ,ResD_$Control.name$, &DType, &DItem, &tempRect);/* Get the item */
  131. if (PtInRect(MyPt,&tempRect))
  132.     {
  133.     CItem = (ControlHandle)DItem;            /* Make it a controlhandle */
  134.     code = TestControl(CItem,MyPt);            /* Get where in the Scrollbar we were pressed */
  135.     HandleWScrollBar(MyPt,code,$Control.StepScroll$,$Control.PageScroll$,CItem);/* Handle the scrollbar */
  136.     }
  137.  
  138. $$EndLoop
  139. $$Loop Control.type = UGauge
  140. GetDItem (theDialog ,ResD_$Control.name$, &DType, &DItem, &tempRect);/* Get the item */
  141. if (PtInRect(MyPt,&tempRect))
  142.     {
  143.     CItem = (ControlHandle)DItem;            /* Make it a controlhandle */
  144.     code = TestControl(CItem,MyPt);            /* Get where in the gauge we were pressed */
  145.     HandleWScrollBar(MyPt,code,$Control.StepScroll$,$Control.PageScroll$,CItem);/* Handle the scrollbar */
  146.     }
  147.  
  148. $$EndLoop
  149. }
  150.  
  151. /* ======================================================= */
  152.  
  153. /* Routine: Refresh */
  154. /* Purpose: Refresh the dialogs non-controls */
  155.  
  156. void CmmD$Worksheet.name$::Refresh()
  157. {
  158. Rect            rTempRect;                        /* Temp rectangle used for drawing */
  159. short            DType;                            /* Type of dialog item */
  160. Handle            DItem;                            /* Handle to the dialog item */
  161. ControlHandle    CItem;                            /* Control handle */
  162. RGBColor        Saved_ForeColor;                /* Save colors */
  163. RGBColor        Saved_BackColor;                /* Save colors */
  164.  
  165.  
  166. SetPort(this->theWindow);                        /* Point to our dialog window */
  167. rTempRect = tempRect;                            /* Save the current contents of  tempRect */
  168. if (Has.ColorQD)                                /* See if color QuickDraw is around */
  169.     {
  170.     GetForeColor(&Saved_ForeColor);                /* Save the fore color */
  171.     GetBackColor(&Saved_BackColor);                /* Save the back color */
  172.  
  173.     RGBForeColor(&Black_ForeColor);                /* Set the fore color to Black */
  174.     RGBBackColor(&White_BackColor);                /* Set the back color to White */
  175.     }
  176.  
  177. $$Loop Control.type = Button
  178. $$if Control.Default
  179. /* This is the default selection, when RETURN is pressed. */
  180. HiliteDefaultButton(this->theWindow,ResD_$Control.name$);
  181.  
  182. $$endif Control.Default
  183. $$EndLoop Control.type
  184. $$Loop Control.type = Line
  185. /* Draw a line, $Control.FullName$ */
  186. $$if Control.GrayLine
  187. PenPat(qd.gray);                                        /* Set the gray pen pattern */
  188. $$endif Control.GrayLine
  189. $$if Control.LineWidth ! 1
  190. PenSize($Control.LineWidth$,$Control.LineWidth$);
  191. $$endif Control.LineWidth
  192. MoveTo($Control.LeftPosition$,$Control.TopPosition$);        /* Horz,vert, Move to starting position */
  193. LineTo($Control.RightPosition$,$Control.BottomPosition$);    /* Horz,vert, Draw to the ending position */
  194. $$if Control.LineWidth ! 1
  195. PenSize(1,1);
  196. $$endif Control.LineWidth
  197. $$if Control.GrayLine
  198. PenPat(qd.black);                                        /*  Back to default pen pattern  */
  199. $$endif Control.GrayLine
  200.  
  201. $$EndLoop
  202. $$Loop Control.type = StaticText
  203. $$if Control.SpecialText
  204. /* Draw static text */
  205. $$if Control.TextColor ! Black
  206. if (Has.ColorQD)                                    /* See if color QuickDraw is around */
  207.     {
  208.     DrawingColor.red = 0x$Control.RedTextColor$;
  209.     DrawingColor.green = 0x$Control.GreenTextColor$;
  210.     DrawingColor.blue = 0x$Control.BlueTextColor$;
  211.     RGBForeColor(&DrawingColor);                    /* Set the fore color */
  212.     RGBBackColor(&Saved_BackColor);                    /* Set the back color */
  213.     }
  214. $$endif Control.TextColor
  215. $$if Control.MultipleLine
  216. SetRect(&tempRect,$Control.LeftPosition$,$Control.TopPosition$,$Control.RightPosition$,$Control.BottomPosition$);
  217. DrawStaticTextBox(sResD_$Control.name$,&tempRect,$Control.TextAlignment$,$Control.TextSize$,$Control.TextFont$,$Control.TextStyle$);
  218. $$endif Control.MultipleLine
  219. $$if Control.SingleLine
  220. DrawStaticLine(sResD_$Control.name$,$Control.LeftPosition$,$Control.TopPosition$,$Control.TextSize$,$Control.TextFont$,$Control.TextStyle$);
  221. $$endif Control.SingleLine
  222. $$if Control.TextColor ! Black
  223. if (Has.ColorQD)                                    /* See if color QuickDraw is around */
  224.     {
  225.     RGBForeColor(&Black_ForeColor);                    /* Set the fore color */
  226.     RGBBackColor(&White_BackColor);                    /* Set the back color */
  227.     }
  228. $$endif Control.TextColor
  229.  
  230. $$endif Control.SpecialText
  231. $$EndLoop
  232. $$Loop Control.type = List
  233. UpdateTheList(this->theWindow->visRgn,this->List_$Control.name$,
  234.     &this->ListRect_$Control.name$,$Control.TextSize$,$Control.TextFont$,$Control.TextStyle$,true);
  235.  
  236. $$EndLoop
  237. TextSize(12);
  238. TextFont(systemFont);                                /* Select the Font that we want */
  239. TextFace(0);                                        /* Select the style that we want */
  240.  
  241. if (Has.ColorQD)                                /* See if color QuickDraw is around */
  242.     {
  243.     RGBForeColor(&Saved_ForeColor);                /* Restore the fore color */
  244.     RGBBackColor(&Saved_BackColor);                /* Restore the back color */
  245.     }
  246. }
  247.  
  248. /* ======================================================= */
  249.  
  250. /* Routine: BringUpDialog */
  251. /* Purpose: Modal dialog */
  252.  
  253. void CmmD$Worksheet.name$::BringUpDialog()
  254. {
  255. Rect        tempRect;                                /* Temporary rectangle */
  256. short        DType;                                    /* Type of dialog item */
  257. short        Index;                                    /* For looping */
  258. Handle        DItem;                                    /* Handle to the dialog item */
  259. ControlHandle    CItem;                                /* Control handle */
  260. ControlHandle    CTempItem;                            /* Control handle */
  261. Str255        sTemp;                                    /* Get text entered, temp holding */
  262. short        itemHit;                                /* Get selection */
  263. short        temp;                                    /* Get selection, temp holding */
  264. short        theSelection;                            /* For Palettes */
  265. long        theLong,LTemp2;                            /* For Hotspot setup */
  266. short        theRow;                                    /* This is used to define the row used in a list */
  267. GrafPtr        SavedPort;                                /* Previous grafport */
  268. Point        MyPt;
  269. DialogPtr    theDialog;
  270. #if defined(powerc) || defined(__powerc)
  271. ModalFilterUPP    theFilter;
  272. #endif
  273.  
  274.  
  275. #if defined(powerc) || defined(__powerc)
  276. theFilter = NewModalFilterProc(theModalDialogFilter);
  277. #endif
  278. gCurrentModalDialog = g$Worksheet.name$;
  279.  
  280. GetPort(&SavedPort);                                /* Get the previous grafport */
  281. HoldOffUserEvents = true;                            /* Hold off the user events */
  282.  
  283. this->theWindow = GetNewDialog(ResD_$Worksheet.name$,nil,(WindowPtr)-1);/* Bring in the dialog resource */
  284. theDialog = this->theWindow;
  285. SetPort(theDialog);            /* Prepare to add conditional text */
  286.  
  287. $$if Worksheet.Center
  288. tempRect = theDialog->portRect;            /* Get the windows position and size */
  289. $$if Worksheet.CenterHorz
  290. tempRect.left = ((screenRect.bounds.right - screenRect.bounds.left) - (tempRect.right - tempRect.left)) / 2;    /* Center Horz */
  291. $$endif Worksheet.CenterHorz
  292. $$if Worksheet.CenterVert
  293. tempRect.top = ((screenRect.bounds.bottom - screenRect.bounds.top) - (tempRect.bottom - tempRect.top)) / 3;    /* 1/3 vert */
  294.     if (tempRect.top < 40)                            /* Keep below the menu bar */
  295.     tempRect.top = 40;
  296. $$endif Worksheet.CenterVert
  297. MoveWindow(theDialog,tempRect.left,tempRect.top,true);
  298.  
  299. $$endif
  300. $$Loop Control.type = Button
  301. /* Button */
  302. SetupNormalControl(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,0);
  303.  
  304. $$EndLoop Button
  305. $$Loop Control.type = Checkbox
  306. /* Checkbox */
  307. SetupNormalControl(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  308.     this->Value_$Control.name$);
  309.  
  310. $$EndLoop Checkbox
  311. $$Loop Control.type = Radio
  312. /* Radio button */
  313. SetupNormalControl(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  314.     this->Value_$Control.name$);
  315.  
  316. $$EndLoop Radio
  317. $$Loop Control.type = List
  318. /* Make a List */
  319. Make_A_List(&this->List_$Control.name$,&this->ListRect_$Control.name$,
  320.     theDialog,sResD_$Control.name$,$Control.TextSize$,$Control.TextFont$,$Control.TextStyle$,true);
  321.  
  322. $$EndLoop
  323. $$Loop Control.type = HotRect
  324. /* Draw a Hotspot or Rectangle */
  325. SetupHotSpot(theDialog,ResD_$Control.name$,$Control.MakeHotSpot$,$Control.LineWidth$,
  326.     $Control.ShadowWidth$,sResD_$Control.name$,this->Enable_$Control.name$);
  327.  
  328. $$EndLoop
  329. $$Loop Control.type = EditText
  330. GetDItem(theDialog,ResD_$Control.name$,&DType,&DItem,&tempRect);/* Get the item handle */
  331. GetIndString(sTemp,sResD_$Control.name$,1);            /* ...Edit text, default value */
  332. SetIText(DItem,sTemp);                                /* Set the default text string */
  333. SelIText(theDialog,ResD_$Control.name$,0,300);
  334.  
  335. $$EndLoop
  336. $$Loop Control.type = Popup
  337. SetupPopupMenu(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  338.     mResD_$Control.name$,this->Value_$Control.name$);
  339.  
  340. $$EndLoop
  341. $$Loop Control.type = Picture
  342. $$if Control.NonGraphic
  343. /* Draw a picture */
  344. LTemp = ResD_N_$Control.name$;                        /* Picture ID and resize flag */
  345. $$if Control.ClipPicture
  346. LTemp = 0x00010000 | LTemp;
  347. $$endif Control.ClipPicture
  348. SetupTheItem(theDialog,ResD_$Control.name$,true,true,
  349.     this->Enable_$Control.name$,false,&tempRect,LTemp,0);/* Setup the Picture button */
  350.  
  351. $$endif Control.NonGraphic
  352. $$EndLoop
  353. $$Loop Control.type = Palette
  354. /* Draw a Palette */
  355. SetupPalette(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  356.     $Control.NumRows$,$Control.NumColumns$,ResD_N_$Control.name$,$Control.HMethod$);
  357.  
  358. $$EndLoop
  359. $$Loop Control.type = Icon
  360. $$if Control.NonGraphic
  361. /* Draw an Icon button */
  362. SetupIconSicn(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  363.     ResD_N_$Control.name$,ResD_H_$Control.name$);
  364.  
  365. $$endif Control.NonGraphic
  366. $$EndLoop
  367. $$Loop Control.type = Sicn
  368. /* Draw an Sicn */
  369. $$if Control.Graphic
  370. SetupIconSicn(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  371.     ResD_N_$Control.name$,ResD_N_$Control.name$);
  372. $$endif Control.Graphic
  373. $$if Control.NonGraphic
  374. SetupIconSicn(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  375.     ResD_N_$Control.name$,ResD_H_$Control.name$);
  376. $$endif Control.NonGraphic
  377.  
  378. $$EndLoop
  379. $$Loop Control.type = UButton
  380. SetupPlugin(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  381.     ResD_N_$Control.name$,ResD_H_$Control.name$,sResD_$Control.name$);
  382.  
  383. $$EndLoop
  384. $$Loop Control.type = UToggle
  385. SetupPlugin(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  386.     ResD_N_$Control.name$,ResD_H_$Control.name$,sResD_$Control.name$);
  387.  
  388. $$EndLoop
  389. $$Loop Control.type = UGauge
  390. SetupPlugin(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  391.     ResD_N_$Control.name$,ResD_H_$Control.name$,sResD_$Control.name$);
  392. SetupMinMaxValue(theDialog,ResD_$Control.name$,$Control.MinScroll$,$Control.MaxScroll$,this->Value_$Control.name$);
  393.  
  394. $$EndLoop
  395. $$Loop Control.type = ScrollBar
  396. SetupTheItem(theDialog,ResD_$Control.name$,true,true,
  397.     this->Enable_$Control.name$,true,&tempRect,0,0);
  398. SetupMinMaxValue(theDialog,ResD_$Control.name$,$Control.MinScroll$,$Control.MaxScroll$,this->Value_$Control.name$);
  399.  
  400. $$EndLoop
  401.  
  402. this->ExitDialog = false;                            /* Do not exit dialog handle loop yet */
  403.  
  404. $$Link    Worksheet.Open
  405.  
  406. this->ExtraSetup();                                    /* Call user Dialog setup routine */
  407.  
  408. ShowWindow(theDialog);                                /* Open a dialog box */
  409. SelectWindow(theDialog);                            /* Lets see it */
  410.  
  411. do                                                    /* Start of dialog handle loop */
  412.     {
  413. #if defined(powerc) || defined(__powerc)
  414.     ModalDialog(theFilter,&itemHit);    /* Wait until an item is hit */
  415. #else
  416.     ModalDialog((ModalFilterProcPtr)&theModalDialogFilter,&itemHit);    /* Wait until an item is hit */
  417. #endif
  418.  
  419.     this->DoItemHit(&itemHit,&this->ExitDialog);            /* Let user handle the item hit */
  420.  
  421.     if (itemHit == 32000)                            /* Check for update */
  422.         {
  423.         this->Refresh();                            /* Draw any Lists, lines, or rectangles */
  424.         EndUpdate(theDialog);                         /* End of the update */
  425.         }
  426.     else if (itemHit > 0)
  427.         {
  428.         GetDItem(theDialog,itemHit,&DType,&DItem,&tempRect);    /* Get item information */
  429.         CItem = (ControlHandle)DItem;                /* Get the control handle */
  430.         }
  431.  
  432.     $$Loop Control.type = Button
  433.     if (itemHit == ResD_$Control.name$)                /* Handle the Button being pressed */
  434.         {
  435.         $$Link    Control.Select
  436.         $$if Control.ExitDialog
  437.         this->ExitDialog = true;                            /* Close this dialog, exit */
  438.         $$endif Control.ExitDialog
  439.         }
  440.  
  441.     $$EndLoop Control.type
  442.     $$Loop Control.type = Checkbox
  443.     if (itemHit == ResD_$Control.name$)                /* Handle the checkbox being pressed */
  444.         {
  445.         temp = GetCtlValue(CItem);                    /* Get the current Checkbox value */
  446.         SetCtlValue(CItem, (temp + 1) & 1);            /* Toggle the value to the opposite */
  447.         this->Value_$Control.name$ = GetCtlValue(CItem);    /* Get the current Checkbox value */
  448.         $$if Control.HasLinks
  449.         if (this->Value_$Control.name$ == 0)
  450.             {
  451.             $$Link    Control.Deselect
  452.             }
  453.         else
  454.             {
  455.             $$Link    Control.Select
  456.             }
  457.         $$endif
  458.         }
  459.  
  460.     $$EndLoop Control.type
  461.     $$Loop Control.type = UButton
  462.     $$if Control.HasLinks
  463.     if (itemHit == ResD_$Control.name$)                /* Handle the Button being pressed */
  464.         {
  465.         $$Link    Control.Select
  466.         }
  467.  
  468.     $$endif
  469.     $$EndLoop Control.type
  470.     $$Loop Control.type = UToggle
  471.     if (itemHit == ResD_$Control.name$)                /* Handle the checkbox being pressed */
  472.         {
  473.         temp = GetCtlValue(CItem);                    /* Get the current Checkbox value */
  474.         SetCtlValue(CItem, (temp + 1) & 1);            /* Toggle the value to the opposite */
  475.         this->Value_$Control.name$ = GetCtlValue(CItem);    /* Get the current Checkbox value */
  476.         $$if Control.HasLinks
  477.         if (this->Value_$Control.name$ == 0)
  478.             {
  479.             $$Link    Control.Deselect
  480.             }
  481.         else
  482.             {
  483.             $$Link    Control.Select
  484.             }
  485.         $$endif
  486.         }
  487.  
  488.     $$EndLoop Control.type
  489.     $$Loop Control.type = Radio
  490.     if (itemHit == ResD_$Control.name$)            /* Handle the Radio being pressed */
  491.         {
  492.         SetCtlValue(CItem,1);
  493.         this->Value_$Control.name$ = 1;    /* Set the current Radio value */
  494.  
  495.         $$Loop RadioGroup
  496.         ClearTheRadio(theDialog,ResD_$Control.name$,&this->Value_$Control.name$);
  497.         $$EndLoop RadioGroup
  498.         $$Link    Control.Select
  499.         }
  500.  
  501.     $$EndLoop Control.type
  502.     $$Loop Control.type = HotRect
  503.     $$if Control.HotSpot
  504.     $$if Control.HasLinks
  505.     if (itemHit == ResD_$Control.name$)                /* Handle the HotSpot being pressed */
  506.         {
  507.         $$Link    Control.Select
  508.         }
  509.  
  510.     $$endif
  511.     $$endif Control.HotSpot
  512.     $$EndLoop
  513.     $$Loop Control.type = Popup
  514.     $$EndLoop
  515.     $$Loop Control.type = Picture
  516.     $$if Control.NonGraphic
  517.     $$if Control.HasLinks
  518.     if (itemHit == ResD_$Control.name$)                /* Handle the Picture being pressed */
  519.         {
  520.         $$Link    Control.Select
  521.         }
  522.  
  523.     $$endif
  524.     $$endif Control.NonGraphic
  525.     $$EndLoop
  526.     $$Loop Control.type = Palette
  527.     $$EndLoop
  528.     $$Loop Control.type = Icon
  529.     $$if Control.NonGraphic
  530.     $$if Control.HasLinks
  531.     if (itemHit == ResD_$Control.name$)                /* Handle the Icon being pressed */
  532.         {
  533.         $$Link    Control.Select
  534.         }
  535.  
  536.     $$endif
  537.     $$endif Control.NonGraphic
  538.     $$EndLoop
  539.     $$Loop Control.type = Sicn
  540.     $$if Control.NonGraphic
  541.     $$if Control.HasLinks
  542.     if (itemHit == ResD_$Control.name$)                /* Handle the Sicn being pressed */
  543.         {
  544.         $$Link    Control.Select
  545.         }
  546.  
  547.     $$endif
  548.     $$endif Control.NonGraphic
  549.     $$EndLoop
  550.     }
  551. while (!this->ExitDialog);                            /* Handle dialog items until exit selected */
  552.  
  553. /* Get results after dialog */
  554.  
  555. this->Exit();    /* Exiting the modal dialog */
  556.  
  557. $$Link    Worksheet.Close
  558.  
  559. SetPort(SavedPort);                                    /* Restore the previous grafport */
  560. DisposDialog(theDialog);        /* Flush the dialog out of memory */
  561.  
  562. gCurrentModalDialog = nil;
  563. HoldOffUserEvents = false;                            /* Let in the user events */
  564. }
  565.  
  566. /* ======================================================= */
  567. /* ======================================================= */
  568. $$CloseFile
  569. $$EndLoop
  570.  
  571.  
  572.